package com.homework.work03;

public class ArrayDemo10 {
    public static void main(String[] args) {
        //1.矩形
        int[][] arr1 = new int[4][3];
        //2.循环赋值
        for(int y=0;y<arr1.length;y++) {
            for(int x=0;x<arr1[y].length;x++) {
                arr1[y][x] = 1;
            }
        }
        //3.循环遍历
        for(int y=0;y<arr1.length;y++) {
            for(int x=0;x<arr1[y].length;x++) {
                System.out.print(arr1[y][x]+"\t");
            }
            System.out.println();
        }
        //2.直角三角形练习
        String[][] arr2 = new String[4][];
        //3.循环赋值
        for(int y=0;y<arr2.length;y++) {
            //4.定义一维数组
            arr2[y] = new String[y+1];
            for(int x=0;x<arr2[y].length;x++) {
                arr2[y][x] = "*";
            }
        }
        //4.打印二维数组
        for(int y=0;y<arr2.length;y++) {
            for(int x=0;x<arr2[y].length;x++) {
                System.out.print(arr2[y][x]);
            }
            System.out.println();
        }
    }
}
